package com.sgb.kjwl.view.widget;

import android.content.Context;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.sgb.kjwl.R;
import com.sgb.link.entity.PublicTypeEntity;
import com.sgb.kjwl.view.ui.adapter.machine.MachineTypeAdapter;
import com.swgk.core.dialog.BasePopWindow;
import com.swgk.core.dialog.PopViewHolder;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;

import java.util.List;

@Deprecated
public class MachineTypeWindow extends BasePopWindow {

    private RecyclerView recyclerView;
    private MachineTypeAdapter machineTypeAdapter;
    private List<PublicTypeEntity> publicTypeEntityList;

    public MachineTypeWindow(Context context) {
        super(context);
    }

    @Override
    protected int popLayout() {
        return R.layout.popwindow_machine_type;
    }

    @Override
    protected void initView(PopViewHolder holder) {
        recyclerView = holder.getPop().findViewById(R.id.rlv_list);
        machineTypeAdapter = new MachineTypeAdapter(mContext, null);
        machineTypeAdapter.setItemSelect(true);
        recyclerView.setLayoutManager(new GridLayoutManager(mContext, 3));
        recyclerView.setAdapter(machineTypeAdapter);
        machineTypeAdapter.setOnItemClick(new AdapterOnItemClick<PublicTypeEntity>() {
            @Override
            public void onItemClick(PublicTypeEntity publicTypeEntity, int position) {
                dissMiss();
                if (onResultClick != null) {

                }
            }
        });
    }

    public void setData(List<PublicTypeEntity> publicTypeEntityList) {
        this.publicTypeEntityList = publicTypeEntityList;
        machineTypeAdapter.setDatas(publicTypeEntityList);
    }
}
